﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Windows;
using System.Windows.Media;
using System.IO;
using System.Windows.Forms;
using Zeta;
using Zeta.Common;
using Zeta.Common.Plugins;
using Zeta.Internals;
using Zeta.Internals.Actors;
using Zeta.Internals.Service;

namespace ProfileHelper
{
    public class ProfileHelper : IPlugin
    {
        #region Iplugin
        public bool Equals(IPlugin other)
        {
            // we should probably be comparing versions too
            return other.Name == Name;
        }

        public string Author
        {
            get { return "Inrego"; }
        }

        public string Description
        {
            get { return "Gives you relevant information to make profiles."; }
        }

        public string Name
        {
            get { return "Profile Helper"; }
        }

        public Version Version
        {
            get { return new Version(1, 0); }
        }

        public Window DisplayWindow
        {
            get
            {
                Logging.Write(LogColor, "questId=\"{0}\" stepId=\"{1}\" x=\"{2}\" y=\"{3}\" z=\"{4}\" levelArea=\"{5}\"", ZetaDia.CurrentQuest.QuestSNO, ZetaDia.CurrentQuest.StepId, ZetaDia.Me.Position.X, ZetaDia.Me.Position.Y, ZetaDia.Me.Position.Z, ZetaDia.Me.WorldDynamicId);
                return null;
            }
        }

        private void RegKeys()
        {

            Hotkeys.RegisterHotkey("Recording ",
                () => Record(),
                System.Windows.Forms.Keys.F12);

        }

        private static void Record()
        {
            Logging.Write(LogColor, "questId=\"{0}\" stepId=\"{1}\" x=\"{2}\" y=\"{3}\" z=\"{4}\" levelArea=\"{5}\"", ZetaDia.CurrentQuest.QuestSNO, ZetaDia.CurrentQuest.StepId, ZetaDia.Me.Position.X, ZetaDia.Me.Position.Y, ZetaDia.Me.Position.Z, ZetaDia.Me.WorldDynamicId);
        }
        /// <summary> Executes the shutdown action. This is called when the bot is shutting down. (Not when Stop() is called) </summary>
        public void OnShutdown()
        {
        }

        /// <summary> Executes the enabled action. This is called when the user has enabled this specific plugin via the GUI. </summary>
        public void OnEnabled()
        {
            Logging.Write("Profile Helper enabled.");
        }

        /// <summary> Executes the disabled action. This is called whent he user has disabled this specific plugin via the GUI. </summary>
        public void OnDisabled()
        {
            Logging.Write("Profile Helper disabled.");
        }

        #endregion
        private static Color LogColor
        {
            get
            {
                return Color.FromRgb(220, 20, 60);
            }
        }
        public void OnInitialize()
        {
            {
                RegKeys();
            }
        }

        public void OnPulse()
        {
            
        }
    }
}
